<%-- 
    Document   : s2
    Created on : 2014/3/3, 下午 04:24:16
    Author     : Gjun
--%>

<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Filter.DAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%  
    String sql="SELECT DATEPART(MONTH, order_date) AS 月份, SUM(product_price * order_quantity) AS 總金額 FROM order_detail GROUP BY DATEPART(MONTH, order_date) ORDER BY 總金額 DESC";
    DAO db = new DAO();
    ArrayList<HashMap> rslist= db.query(sql, new String[]{});    
 HashMap amap ; 
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
     <style>
            #size{
                width:400px;
                height:300px;
            }
            #listbox{
                border-style: solid;
                border-width: 2px;             
            }
            body{background-color:#EEE;}
            .BOX{width: available;
                 height: 100px ;
                
                
                 position: absolute;
                 left: 25%;
                 top:  30%;
                 
                 margin-top:  -150px;
                 margin-left:  -150px;} 
           
        </style>
    </head>
    <body>
        <table id="table" border="1"> 
               
                <tr><td>月份</td><td>總金額</td></tr>
        <%
                  for(int i =0;i<rslist.size();i++)
                  {
                      amap =rslist.get(i); 
                     out.println("<tr><td>"+amap.get("月份")+
                              "</td><td align='right'>"
                                +amap.get("總金額")
                                +"</td></tr></th>");
                  }
        %>
           <br>
           <a href='ProductManagement.jsp'>返回產品管理列表</a>
          <br>
     </table>
        </body>
</html>
